package com.wt.chat.schedule.processor;

import com.wt.chat.cache.RedisCache;
import com.wt.chat.model.KefuModel;
import com.wt.chat.utils.Keys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description
 * @author: wangtao
 * @date:15:25 2019/11/19
 * @email:taow02@jumei.com
 */
@Service
public class ChangeKefuStatusProcessor implements DialogAssignProcessor {

	@Autowired
	private RedisCache redisCache;


	@Override
	public boolean canProcess(ProcessParameter parameter) {
		return true;
	}

	@Override
	public void process(ProcessParameter parameter) {
		KefuModel kefu = parameter.getKefu();
		kefu.setCurrentDialogCount(kefu.getCurrentDialogCount() + 1);
		redisCache.hset(Keys.KEFU_ONLINE_HASH_KEY, kefu.getId() + "", kefu);
	}
}
